<?php
class SettingSaveTemplateAction extends AdminAction
{
	public function __construct()
	{
		parent::__construct();
		$this->responseType = 'json';
	}
	
	protected function afterConstruct()
	{
		$this->parseDtds('template','setting');
	}
	
	public function execute()
	{
		$data = $this->getValidData();
		Util::updateSetting($data);
		
		AdminUtil::clearAdCache();
		
		//TODO 清空模板缓存
		if(!AdminUtil::clearTemplateCache('frontend'))
		{
			$this->code = 500;
		}
		else
		{
			$this->code = 200;
		}
	}
}
